﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace EasyTrader.Order
{
    public class ETOrderDataSet : System.Data.DataSet
    {
        // 현재 테이블들을 XML로 저장한다.
        public void SaveTablesToXML()
        {
            int tableCount = this.Tables.Count;
            for (int i = 0; i < tableCount; i++)
            {
                EasyTrader.DataSet.ETDataTable curTable = (EasyTrader.DataSet.ETDataTable)Tables[i];
                curTable.SaveTableToXml();
            }
        }

        public ETOrderDataSet(string a_Name)
            : base(a_Name)
        {
        }

        public OrderTable GetOrderTable(string a_AccountNum)
        {
            OrderTable curTable = (EasyTrader.Order.OrderTable)this.Tables[a_AccountNum];
            return curTable;
        }
        public string GetTableName(int a_Index)
        {
            string tableName = "";
            if (a_Index < 0 || a_Index >= this.Tables.Count)
                return tableName;

            tableName = this.Tables[a_Index].TableName;
            return tableName;
        }
        public void CreateOrderTable(string a_TableName)
        {
            OrderTable curTable = new OrderTable(a_TableName);
            AddTable(curTable);
        }

        public void AddTable(DataTable a_DataTable)
        {
            this.Tables.Add(a_DataTable);
        }

        public OrderTable GetTable(string a_TableName)
        {
            return (OrderTable)this.Tables[a_TableName];
        }
    }
}
